<?php

namespace app\model\zs;

use think\Model;

class ZsTwCoupon extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'tw_coupons';

    // 设置当前模型的数据库连接
    protected $connection = 'zs';

    // 创建者类型,1:平台,2:商户
    const CREATE_TYPE_APP = 1;
    const CREATE_TYPE_STORE = 2;

    // 抵扣类型,1:抵扣商品,2:抵扣配送费
    const CATE_GOOD_AMOUNT = 1;
    const CATE_SEND_FEE = 2;

    // 优惠券上/下架状态,0:下架,1:上架
    const REV_STATUS_OFF = 0;
    const REV_STATUS_ON = 1;

    // 优惠券领取方式,1:手动,2:自动
    const REV_TYPE_MAN = 1;
    const REV_TYPE_AUTO = 2;

    // 优惠券承担方式,1:平台承担,2:商家承担,3:自定义
    const BEAR_TYPE_APP = 1;
    const BEAR_TYPE_STORE = 2;
    const BEAR_TYPE_DEFINE = 3;

    public static function createTypeRel()
    {
        return [
            self::CREATE_TYPE_APP => '由平台创建',
            self::CREATE_TYPE_STORE => '由商家创建',
        ];
    }

    public static function receiveStatusRel()
    {
        return [
            0 => '下架',
            1 => '上架',
        ];
    }

    public static function statusRel()
    {
        return [
            0 => '审核中',
            1 => '审核通过',
            2 => '审核未通过',
        ];
    }

    public static function cateRel()
    {
        return [
            self::CATE_GOOD_AMOUNT => '抵扣商品金额',
            self::CATE_SEND_FEE => '抵扣配送费',
        ];
    }

    public static function receiveTypeRel()
    {
        return [
            self::REV_TYPE_MAN => '手动',
            self::REV_TYPE_AUTO => '自动',
        ];
    }

    public static function bearTypeRel()
    {
        return [
            self::BEAR_TYPE_APP => '平台承担',
            self::BEAR_TYPE_STORE => '商家承担',
            self::BEAR_TYPE_DEFINE => '自定义',
        ];
    }
}
